package com.lx.api;

import com.lx.exception.BizException;
import com.lx.api.response.ResponseEntity;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;

@Aspect
@Configuration
public class ControllerAspect {

    @Pointcut(value = "execution(* com.lx.api.BaseRestController+.*(..))")
    private void requestAspect(){}

    @Around(value="requestAspect() && @annotation(org.springframework.web.bind.annotation.RequestMapping)")
    public ResponseEntity aroundExecute(ProceedingJoinPoint joinPoint) throws Throwable {

        Object returnObject = joinPoint.proceed();
        joinPoint.getTarget();
        ResponseEntity resp = new ResponseEntity();
        resp.setData(returnObject);
        return resp;
    }


}
